/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package mrstalk;

/**
 *
 * @author gabriel
 */
public class MsgReceiver implements Runnable {
    public Chat chat = null;
    private ChatWindow chatWindow;

    public MsgReceiver( Chat t_chat, ChatWindow t_chatWindow )
    {
        chat = t_chat;
        chatWindow = t_chatWindow;
    }

    public void run()
    {
        while (chatWindow.isOpen())
        {
            String msg = chat.receiveMsg();
            if ( msg != null )
            {
                chatWindow.updateMsgBox( msg );
            }
        }
    }
}
